package com.shenhaofeng.app.http.response;

import java.io.IOException;

import okhttp3.MediaType;


/**
 * Created by Administrator on 2016/10/13.
 */
public abstract class ResponseBody {


    private byte[] bytes;


    public abstract MediaType contentType();


    public abstract long contentLength();


    protected abstract byte[] readBytes()  throws IOException;


    public byte[] bytes() throws IOException {
        if (bytes == null) {
            bytes = readBytes();
        }
        return bytes;

    }

}
